export interface UserInfoParams {
    id?: number,
    userAccount?: string,
    userName?: string,
    userPassword?: string
}
export interface NameInfoParams {
    id: number,
    userName: string
}
export interface PasswordInfoParams {
    id: number,
    oldUserPassword: string,
    newUserPassword:string
}

export interface InfoResultModel {
    token: string
}

export function getInfoApi(params: UserInfoParams) {
    let data: UserInfoParams = {
        id: params.id,
        userAccount: params.userAccount,
        userName: params.userName,
        userPassword: params.userPassword
    }
    return useGet<InfoResultModel, UserInfoParams>('/user/getUserByToken/{token}', data, {
        token: true,
        customDev: true,
    })
}

export function updateNameApi(params: NameInfoParams) {
    let data: NameInfoParams = {
        id: params.id,
        userName: params.userName
    }
    return usePut<InfoResultModel, NameInfoParams>('/user/editUserName', data, {
        token: true,
        customDev: true,
    })
}

export function updatePasswordApi(params: PasswordInfoParams) {
    let data: PasswordInfoParams = {
        id: params.id,
        oldUserPassword: params.oldUserPassword,
        newUserPassword:params.newUserPassword
    }
    return usePut<InfoResultModel, PasswordInfoParams>('/user/editUserPassword', data, {
        token: true,
        customDev: true,
    })
}